swift_too
moduleSwift_Data
example - querying Swift SDC data and downloading itswifttools
= 3.0.6from swifttools.swift_too import Data
from swifttools.swift_too import ObsQuery
We've demonstrated that with classes such as Swift_ObsQuery
we can find out what Swift has observed, but what if we want to download the data associated with an observation? Before you had to go to a web interface to download the data you wanted. More confusingly, the data usually reside in one of two places: the archive or the quicklook area. Typically recent observations exist in quicklook, and older observations are in the archive.
Swift_Data
aims to make fetching observation data automated, and somewhat abstracted, so you don't have to care about if data are from quicklook or not. Let's find a recent observation, and download it. How about the first few observations of Jan 10th, 2021? As of swifttools
2.3, you can shorten the names of the classes by removing the Swift_
so we'll use just Data
and for the next example, ObsQuery
.
oq = ObsQuery(begin="2022-01-10", length=0.1)
oq
Begin Time | End Time | Target Name | Observation Number | Exposure (s) | Slewtime (s) |
---|---|---|---|---|---|
2022-01-09 23:52:02 | 2022-01-10 00:12:58 | NGC5986 | 00045907009 | 1115 | 141 |
2022-01-10 00:13:02 | 2022-01-10 00:20:57 | PSZ1_G357.43+30.60 | 00085651001 | 410 | 65 |
2022-01-10 00:21:02 | 2022-01-10 00:51:01 | GRB 220101A | 01091527009 | 1610 | 189 |
2022-01-10 00:51:02 | 2022-01-10 01:12:01 | OGP_4313 | 03103018001 | 1080 | 179 |
2022-01-10 01:12:02 | 2022-01-10 01:28:57 | MRK 817 | 00096450022 | 835 | 180 |
2022-01-10 01:29:02 | 2022-01-10 01:36:01 | NGC 5398 | 03110928017 | 275 | 144 |
2022-01-10 01:36:02 | 2022-01-10 01:57:59 | HEN 3-1103 | 00083966007 | 1260 | 57 |
2022-01-10 01:58:02 | 2022-01-10 02:23:00 | RX J0134.2-4258 | 00036528060 | 1355 | 143 |
2022-01-10 02:23:02 | 2022-01-10 02:44:58 | OGP_3952 | 03103167003 | 1185 | 131 |
OK, so that observation fo NGC 5986 is interesting, so let's check it out. The important identifier for any observation is the Observation Number (or Observation ID). In the table above, this is given in SDC format, which is a importantly, a string (those leading zeros are required). So for this observation, the obsid is 00045907009
. However, we don't have to make transcription errors here, it's the first in the oq data structure, i.e...
oq[0]
Begin Time | End Time | Target Name | Observation Number | Exposure (s) | Slewtime (s) |
---|---|---|---|---|---|
2022-01-09 23:52:02 | 2022-01-10 00:12:58 | NGC5986 | 00045907009 | 1115 | 141 |
Swift_Data
classSo let's demonstrate use of the Swift_Data
class. As usual, it can be set up by creating the class and then setting the parameters, then submitting using the submit
method, or you can pass the parameters as arguments to the class. We'll do the former first.
data = Data()
data.obsid = oq[0].obsid
OK so this sets up that we want to fetch data associated with the obsid for NGC5986. Next we have a few options to set. Firstly, there are 5 types of data that can be downloaded. These are:
auxil
: Auxillary data required to process Swift data, including Two Line Element (TLE) to calculated an ephemeris, and spacecraft housekeeping.log
: Log files from the SDC processing. Of interest, but usually inessential for data analysis.xrt
: Data for Swift's X-ray Telescope.bat
: Data for Swift's Burst Alert Telescopeuvot
: Data for Swift's UV/Optical TelescopeIn order to select which data you wish to download, simply set the parameter listed above to true, so if you want XRT data, set xrt = True
. If you just want to get everything, you can set all = True
as a shortcut. Let's get XRT, BAT and UVOT data for this observation, forget about the logs. FYI auxil
data come down by default, as you always need those if you're going to run processing pipeline tools like xrtpipeline
.
data.xrt = True
data.uvot = True
data.bat = True
So in terms of basic configuration, this is pretty much it. Next step is to query the existance of data. This is done by submitting the job.
data.submit()
True
OK that appeared to have worked, so let's look at the files available. In a Jupyter Notebook, just type in the name of the Swift_Data
object we created.
data
Path | Filename | Description |
---|---|---|
00045907009/auxil | SWIFT_TLE_ARCHIVE.txt.22018.37267907.gz | Auxillary TLE file |
'' | sw00045907009pat.fits.gz | Auxillary attitude file |
'' | sw00045907009pjb.par.gz | Auxillary file |
'' | sw00045907009pob.cat.gz | Auxillary catalog |
'' | sw00045907009ppr.par.gz | Auxillary file |
'' | sw00045907009s.mkf.gz | Auxillary file |
'' | sw00045907009sao.fits.gz | Auxillary file |
'' | sw00045907009sat.fits.gz | Auxillary attitude file |
'' | sw00045907009sen.hk.gz | Auxillary housekeeping |
'' | sw00045907009sti.fits.gz | Auxillary file |
'' | sw00045907009uat.fits.gz | Auxillary attitude file |
'' | sw00045907009x.mkf.gz | Auxillary file |
00045907009/xrt/event | sw00045907009xpcw3po_cl.evt.gz | XRT pointed cleaned PC event file |
'' | sw00045907009xpcw3po_uf.evt.gz | XRT pointed unfiltered PC event file |
'' | sw00045907009xwtw2sl_cl.evt.gz | XRT slew cleaned WT event file |
'' | sw00045907009xwtw2sl_uf.evt.gz | XRT slew unfiltered WT event file |
'' | sw00045907009xwtw2sl_ufre.evt.gz | XRT slew unfiltered WT event file |
'' | sw00045907009xwtw2st_cl.evt.gz | XRT settling cleaned WT event file |
'' | sw00045907009xwtw2st_uf.evt.gz | XRT settling unfiltered WT event file |
'' | sw00045907009xwtw2st_ufre.evt.gz | XRT settling unfiltered WT event file |
00045907009/xrt/hk | sw00045907009xbf_rw.img.gz | XRT raw housekeeping data |
'' | sw00045907009xen.hk.gz | XRT housekeeping file |
'' | sw00045907009xhd.hk.gz | XRT housekeeping file |
'' | sw00045907009xtr.hk.gz | XRT housekeeping file |
00045907009/xrt/products | sw00045907009x_skim.gif | XRT sky GIF preview |
'' | sw00045907009xpc_ex.img.gz | XRT exposure map PC data |
'' | sw00045907009xpc_sk.img.gz | XRT sky PC data |
00045907009/bat/hk | sw00045907009bdecb.hk.gz | BAT housekeeping file |
'' | sw00045907009bdp.hk.gz | BAT housekeeping file |
'' | sw00045907009ben.hk.gz | BAT housekeeping file |
'' | sw00045907009bgocb.hk.gz | BAT housekeeping file |
'' | sw00045907009bhd.hk.gz | BAT housekeeping file |
00045907009/bat/masktag | sw00045907009bmt00010003.lc.gz | BAT mask tagged lightcurve |
'' | sw00045907009bmt00010003_rw.lc.gz | BAT raw mask tagged lightcurve |
'' | sw00045907009bmt00010029.lc.gz | BAT mask tagged lightcurve |
'' | sw00045907009bmt00010029_rw.lc.gz | BAT raw mask tagged lightcurve |
'' | sw00045907009bmt00010051.lc.gz | BAT mask tagged lightcurve |
'' | sw00045907009bmt00010051_rw.lc.gz | BAT raw mask tagged lightcurve |
00045907009/bat/rate | sw00045907009brt1s.lc.gz | BAT rate lightcurve |
'' | sw00045907009brtmc.lc.gz | BAT rate lightcurve |
'' | sw00045907009brtms.lc.gz | BAT rate lightcurve |
'' | sw00045907009brtqd.lc.gz | BAT rate lightcurve |
00045907009/bat/survey | sw00045907009bsvpbo2b4dg0919.dph.gz | BAT survey DPH |
'' | sw00045907009bsvpbo2b6cg0920.dph.gz | BAT survey DPH |
00045907009/uvot/hk | sw00045907009uac.hk.gz | UVOT housekeeping file |
'' | sw00045907009uaf.hk.gz | UVOT housekeeping file |
'' | sw00045907009uct.hk.gz | UVOT housekeeping file |
'' | sw00045907009uen.hk.gz | UVOT housekeeping file |
'' | sw00045907009uer.hk.gz | UVOT housekeeping file |
'' | sw00045907009ues.hk.gz | UVOT housekeeping file |
00045907009/uvot/image | sw00045907009uuu_ex.img.gz | UVOT exposure map u data |
'' | sw00045907009uuu_rw.img.gz | UVOT raw u data |
'' | sw00045907009uuu_sk.img.gz | UVOT sky u data |
00045907009/uvot/products | sw00045907009u.cat.gz | UVOT catalog |
'' | sw00045907009u_ex.img.gz | UVOT exposure map data |
'' | sw00045907009u_sk.img.gz | UVOT sky data |
'' | sw00045907009uuuskim.gif | UVOT sky u GIF preview |
OK so what you should see above is a list of all the files, including the subdirectories they will exist in, along with basic description of each file. Importantly, at this stage, the data are not yet downloaded. Let's look in depth at one of these files.
data[0]
Parameter | Value |
---|---|
filename | SWIFT_TLE_ARCHIVE.txt.22018.37267907.gz |
path | 00045907009/auxil |
url | https://heasarc.gsfc.nasa.gov/FTP/swift/data/obs/2022_01/00045907009/a uxil/SWIFT_TLE_ARCHIVE.txt.22018.37267907.gz |
quicklook | False |
type | Auxillary TLE file |
OK so a few things here. Firstly, from the url
you can see where the data reside online. As this is a nasa.gov address, this is the US data center. If you wanted to retrieve from the UK data center, simply pass the parameter uksdc = True
. Similarly if you wish to use the Italian SDC, use itsdc = True
.
Secondly, this is quicklook data. By default Swift_Data
looks in the archive first, but if the data is recent, it will look in quicklook. Note that quicklook data are by their nature preliminary, and can evolve with time. For US and Italian SDC you'll see that the URL has a version number ('009') included, this number increments when the data are changed. For UK SDC, this does not happen, however, you can just redownload data to get the most up-to-date value.
For published papers, we recommend using data from the archive if available.
Final step is to download the data to disk, so we can process the data using our HEAsoft tools. This is perfomed utilizing the download()
method. If we want to specify the directory to download, simply use the outdir
parameter, either as a class parameter, or an argument to download. Let's put in in our computer's Downloads directory.
data.download(outdir="~/Downloads")
Downloading files: 0%| | 0/57 [00:00<?, ?files/s]
True
If you have tqdm
installed, you should have seen a progress bar showing how many files were downloaded. If not, then you'll just see a simple text message. Now the data should be in the Downloads directory, in a directory named after the obsid
of the data we requested. Note that the files inside are gzipped by default, but do not need to be decompressed to be used with the HEAsoft tools, so you can save some disk space!
Next thing we'll demonstrate is downloading data in one line of code. This is very simple, just pass the arguments when you intiate the class, and it will download the data itself. If you want to do this, and not download the data automatically, pass the argument fetch=False
. We'll fetch the 3rd observation above, but just the XRT data:
newdata = Data(obsid=oq[2].obsid, xrt=True, outdir="~/Downloads")
Downloading files: 0%| | 0/27 [00:00<?, ?files/s]
That should have downloaded the auxil
and xrt
data for that observation in into your Downloads directory. Let's look at the file structure.
newdata
Path | Filename | Description |
---|---|---|
01091527009/auxil | SWIFT_TLE_ARCHIVE.txt.22020.02942007.gz | Auxillary TLE file |
'' | sw01091527009pat.fits.gz | Auxillary attitude file |
'' | sw01091527009pjb.par.gz | Auxillary file |
'' | sw01091527009pob.cat.gz | Auxillary catalog |
'' | sw01091527009ppr.par.gz | Auxillary file |
'' | sw01091527009s.mkf.gz | Auxillary file |
'' | sw01091527009sao.fits.gz | Auxillary file |
'' | sw01091527009sat.fits.gz | Auxillary attitude file |
'' | sw01091527009sen.hk.gz | Auxillary housekeeping |
'' | sw01091527009sti.fits.gz | Auxillary file |
'' | sw01091527009uat.fits.gz | Auxillary attitude file |
'' | sw01091527009x.mkf.gz | Auxillary file |
01091527009/xrt/event | sw01091527009xpcw3po_cl.evt.gz | XRT pointed cleaned PC event file |
'' | sw01091527009xpcw3po_uf.evt.gz | XRT pointed unfiltered PC event file |
'' | sw01091527009xwtw2sl_cl.evt.gz | XRT slew cleaned WT event file |
'' | sw01091527009xwtw2sl_uf.evt.gz | XRT slew unfiltered WT event file |
'' | sw01091527009xwtw2sl_ufre.evt.gz | XRT slew unfiltered WT event file |
'' | sw01091527009xwtw2st_cl.evt.gz | XRT settling cleaned WT event file |
'' | sw01091527009xwtw2st_uf.evt.gz | XRT settling unfiltered WT event file |
'' | sw01091527009xwtw2st_ufre.evt.gz | XRT settling unfiltered WT event file |
01091527009/xrt/hk | sw01091527009xbf_rw.img.gz | XRT raw housekeeping data |
'' | sw01091527009xen.hk.gz | XRT housekeeping file |
'' | sw01091527009xhd.hk.gz | XRT housekeeping file |
'' | sw01091527009xtr.hk.gz | XRT housekeeping file |
01091527009/xrt/products | sw01091527009x_skim.gif | XRT sky GIF preview |
'' | sw01091527009xpc_ex.img.gz | XRT exposure map PC data |
'' | sw01091527009xpc_sk.img.gz | XRT sky PC data |
Data
classYou don't actually need to use the Swift_Data
AKA Data
class to download data. Any API class that has an associated obsid
as of swifttools 3.0.6
has a download()
method. This method takes the same arguments as Data
to download data, automatically downloads data to local disk, and returns a Data
class as a result. Here's a demonstration:
A reminder, we did an ObsQuery
earlier, let's look at that again:
oq
Begin Time | End Time | Target Name | Observation Number | Exposure (s) | Slewtime (s) |
---|---|---|---|---|---|
2022-01-09 23:52:02 | 2022-01-10 00:12:58 | NGC5986 | 00045907009 | 1115 | 141 |
2022-01-10 00:13:02 | 2022-01-10 00:20:57 | PSZ1_G357.43+30.60 | 00085651001 | 410 | 65 |
2022-01-10 00:21:02 | 2022-01-10 00:51:01 | GRB 220101A | 01091527009 | 1610 | 189 |
2022-01-10 00:51:02 | 2022-01-10 01:12:01 | OGP_4313 | 03103018001 | 1080 | 179 |
2022-01-10 01:12:02 | 2022-01-10 01:28:57 | MRK 817 | 00096450022 | 835 | 180 |
2022-01-10 01:29:02 | 2022-01-10 01:36:01 | NGC 5398 | 03110928017 | 275 | 144 |
2022-01-10 01:36:02 | 2022-01-10 01:57:59 | HEN 3-1103 | 00083966007 | 1260 | 57 |
2022-01-10 01:58:02 | 2022-01-10 02:23:00 | RX J0134.2-4258 | 00036528060 | 1355 | 143 |
2022-01-10 02:23:02 | 2022-01-10 02:44:58 | OGP_3952 | 03103167003 | 1185 | 131 |
The 5th observation up there is Mrk 817, we can access that entry individually like this:
oq[4]
Begin Time | End Time | Target Name | Observation Number | Exposure (s) | Slewtime (s) |
---|---|---|---|---|---|
2022-01-10 01:12:02 | 2022-01-10 01:28:57 | MRK 817 | 00096450022 | 835 | 180 |
So to download the data for that observation, you can simply do the following. We're going to request XRT and UVOT data for this:
oq[4].download(xrt=True,uvot=True, outdir="~/Downloads")
Downloading files: 0%| | 0/60 [00:00<?, ?files/s]
Path | Filename | Description |
---|---|---|
00096450022/auxil | SWIFT_TLE_ARCHIVE.txt.22020.02942007.gz | Auxillary TLE file |
'' | sw00096450022pat.fits.gz | Auxillary attitude file |
'' | sw00096450022pjb.par.gz | Auxillary file |
'' | sw00096450022pob.cat.gz | Auxillary catalog |
'' | sw00096450022ppr.par.gz | Auxillary file |
'' | sw00096450022s.mkf.gz | Auxillary file |
'' | sw00096450022sao.fits.gz | Auxillary file |
'' | sw00096450022sat.fits.gz | Auxillary attitude file |
'' | sw00096450022sen.hk.gz | Auxillary housekeeping |
'' | sw00096450022sti.fits.gz | Auxillary file |
'' | sw00096450022uat.fits.gz | Auxillary attitude file |
'' | sw00096450022x.mkf.gz | Auxillary file |
00096450022/xrt/event | sw00096450022xpcw3po_cl.evt.gz | XRT pointed cleaned PC event file |
'' | sw00096450022xpcw3po_uf.evt.gz | XRT pointed unfiltered PC event file |
'' | sw00096450022xwtw2sl_cl.evt.gz | XRT slew cleaned WT event file |
'' | sw00096450022xwtw2sl_uf.evt.gz | XRT slew unfiltered WT event file |
'' | sw00096450022xwtw2sl_ufre.evt.gz | XRT slew unfiltered WT event file |
'' | sw00096450022xwtw2st_cl.evt.gz | XRT settling cleaned WT event file |
'' | sw00096450022xwtw2st_uf.evt.gz | XRT settling unfiltered WT event file |
'' | sw00096450022xwtw2st_ufre.evt.gz | XRT settling unfiltered WT event file |
00096450022/xrt/hk | sw00096450022xbf_rw.img.gz | XRT raw housekeeping data |
'' | sw00096450022xen.hk.gz | XRT housekeeping file |
'' | sw00096450022xhd.hk.gz | XRT housekeeping file |
'' | sw00096450022xtr.hk.gz | XRT housekeeping file |
00096450022/xrt/products | sw00096450022x_skim.gif | XRT sky GIF preview |
'' | sw00096450022xpc_ex.img.gz | XRT exposure map PC data |
'' | sw00096450022xpc_sk.img.gz | XRT sky PC data |
00096450022/uvot/hk | sw00096450022uac.hk.gz | UVOT housekeeping file |
'' | sw00096450022uaf.hk.gz | UVOT housekeeping file |
'' | sw00096450022uct.hk.gz | UVOT housekeeping file |
'' | sw00096450022uen.hk.gz | UVOT housekeeping file |
'' | sw00096450022uer.hk.gz | UVOT housekeeping file |
'' | sw00096450022ues.hk.gz | UVOT housekeeping file |
00096450022/uvot/image | sw00096450022ubb_ex.img.gz | UVOT exposure map b data |
'' | sw00096450022ubb_rw.img.gz | UVOT raw b data |
'' | sw00096450022ubb_sk.img.gz | UVOT sky b data |
'' | sw00096450022um2_ex.img.gz | UVOT exposure map uvm2 data |
'' | sw00096450022um2_rw.img.gz | UVOT raw uvm2 data |
'' | sw00096450022um2_sk.img.gz | UVOT sky uvm2 data |
'' | sw00096450022uuu_ex.img.gz | UVOT exposure map u data |
'' | sw00096450022uuu_rw.img.gz | UVOT raw u data |
'' | sw00096450022uuu_sk.img.gz | UVOT sky u data |
'' | sw00096450022uvv_ex.img.gz | UVOT exposure map v data |
'' | sw00096450022uvv_rw.img.gz | UVOT raw v data |
'' | sw00096450022uvv_sk.img.gz | UVOT sky v data |
'' | sw00096450022uw1_ex.img.gz | UVOT exposure map uvw1 data |
'' | sw00096450022uw1_rw.img.gz | UVOT raw uvw1 data |
'' | sw00096450022uw1_sk.img.gz | UVOT sky uvw1 data |
'' | sw00096450022uw2_ex.img.gz | UVOT exposure map uvw2 data |
'' | sw00096450022uw2_rw.img.gz | UVOT raw uvw2 data |
'' | sw00096450022uw2_sk.img.gz | UVOT sky uvw2 data |
00096450022/uvot/products | sw00096450022u.cat.gz | UVOT catalog |
'' | sw00096450022u_ex.img.gz | UVOT exposure map data |
'' | sw00096450022u_sk.img.gz | UVOT sky data |
'' | sw00096450022ubbskim.gif | UVOT sky b GIF preview |
'' | sw00096450022um2skim.gif | UVOT sky uvm2 GIF preview |
'' | sw00096450022uuuskim.gif | UVOT sky u GIF preview |
'' | sw00096450022uvvskim.gif | UVOT sky v GIF preview |
'' | sw00096450022uw1skim.gif | UVOT sky uvw1 GIF preview |
'' | sw00096450022uw2skim.gif | UVOT sky uvw2 GIF preview |
That makes downloading data for archival observations quick and easy!
OK, so what if you want to update directory, say the data has been updated. Well we would recommend that you delete the old data, and redownload, and to encourage this, if you try to download again, you'll get an error:
newdata = oq[2].download(xrt=True, outdir="~/Downloads")
Downloading files: 0%| | 0/27 [00:00<?, ?files/s]
WARNING: SWIFT_TLE_ARCHIVE.txt.22020.02942007.gz exists and not overwritten (set clobber=True to override this).
WARNING: sw01091527009pat.fits.gz exists and not overwritten (set clobber=True to override this).
WARNING: sw01091527009pjb.par.gz exists and not overwritten (set clobber=True to override this).
WARNING: sw01091527009pob.cat.gz exists and not overwritten (set clobber=True to override this).
WARNING: sw01091527009ppr.par.gz exists and not overwritten (set clobber=True to override this).
WARNING: sw01091527009s.mkf.gz exists and not overwritten (set clobber=True to override this).
WARNING: sw01091527009sao.fits.gz exists and not overwritten (set clobber=True to override this).
WARNING: sw01091527009sat.fits.gz exists and not overwritten (set clobber=True to override this).
WARNING: sw01091527009sen.hk.gz exists and not overwritten (set clobber=True to override this).
WARNING: sw01091527009sti.fits.gz exists and not overwritten (set clobber=True to override this).
WARNING: sw01091527009uat.fits.gz exists and not overwritten (set clobber=True to override this).
WARNING: sw01091527009x.mkf.gz exists and not overwritten (set clobber=True to override this).
WARNING: sw01091527009xpcw3po_cl.evt.gz exists and not overwritten (set clobber=True to override this).
WARNING: sw01091527009xpcw3po_uf.evt.gz exists and not overwritten (set clobber=True to override this).
WARNING: sw01091527009xwtw2sl_cl.evt.gz exists and not overwritten (set clobber=True to override this).
WARNING: sw01091527009xwtw2sl_uf.evt.gz exists and not overwritten (set clobber=True to override this).
WARNING: sw01091527009xwtw2sl_ufre.evt.gz exists and not overwritten (set clobber=True to override this).
WARNING: sw01091527009xwtw2st_cl.evt.gz exists and not overwritten (set clobber=True to override this).
WARNING: sw01091527009xwtw2st_uf.evt.gz exists and not overwritten (set clobber=True to override this).
WARNING: sw01091527009xwtw2st_ufre.evt.gz exists and not overwritten (set clobber=True to override this).
WARNING: sw01091527009xbf_rw.img.gz exists and not overwritten (set clobber=True to override this).
WARNING: sw01091527009xen.hk.gz exists and not overwritten (set clobber=True to override this).
WARNING: sw01091527009xhd.hk.gz exists and not overwritten (set clobber=True to override this).
WARNING: sw01091527009xtr.hk.gz exists and not overwritten (set clobber=True to override this).
WARNING: sw01091527009x_skim.gif exists and not overwritten (set clobber=True to override this).
WARNING: sw01091527009xpc_ex.img.gz exists and not overwritten (set clobber=True to override this).
WARNING: sw01091527009xpc_sk.img.gz exists and not overwritten (set clobber=True to override this).
However, we can overwrite the existing data, by (as the error message suggests), setting clobber = True
.
newdata.clobber = True
newdata.download()
Downloading files: 0%| | 0/27 [00:00<?, ?files/s]
True
Use of clobber
can be useful also if you decide to you really wanted that UVOT data to go along with your XRT data on that observation. Remember auxil
is fetched by default, so as we already have it, we'll turn it off. This isn't necessary, but if you don't turn it off the data will be redownloaded and overwrite the old data, which wastes bandwidth.
newdata = obsid=oq[2].download(uvot=True, auxil=False, outdir="~/Downloads", clobber=True)
Downloading files: 0%| | 0/17 [00:00<?, ?files/s]
So the looking in the directory listing will show the UVOT data files that you just downloaded to add to your XRT and Auxillary data.
If you want to specify exactly what sort of data you want to download, then you can use pattern matching to filter on only the files you want. Here's how that works. Firstly, let's use a GUANO dump as an example, for these we are primarily interested in the BAT event data file.
from swift_too import GUANO
g = GUANO(begin='2021-01-01',limit=1)
g
Trigger Type | Trigger Time | Offset (s) | Window Duration (s) | Observation ID |
---|---|---|---|---|
GBM GRB | 2021-01-01 14:53:06 | 50 | 200 | 00048753206 |
Let's take a look at the data associated with this GUANO trigger. I'll use the download()
method, but set fetch = False
so that no actual data is downloaded, this will return the directory listing.
g[0].download(bat=True,fetch=False)
Path | Filename | Description |
---|---|---|
00048753206/auxil | SWIFT_TLE_ARCHIVE.txt.21007.72373844.gz | Auxillary TLE file |
'' | sw00048753206pat.fits.gz | Auxillary attitude file |
'' | sw00048753206pjb.par.gz | Auxillary file |
'' | sw00048753206pob.cat.gz | Auxillary catalog |
'' | sw00048753206ppr.par.gz | Auxillary file |
'' | sw00048753206s.mkf.gz | Auxillary file |
'' | sw00048753206sao.fits.gz | Auxillary file |
'' | sw00048753206sat.fits.gz | Auxillary attitude file |
'' | sw00048753206sen.hk.gz | Auxillary housekeeping |
'' | sw00048753206sti.fits.gz | Auxillary file |
'' | sw00048753206x.mkf.gz | Auxillary file |
00048753206/bat/event | sw00048753206bevshpo_uf.evt.gz | BAT pointed unfiltered event event file |
00048753206/bat/hk | sw00048753206bdecb.hk.gz | BAT housekeeping file |
'' | sw00048753206bdp.hk.gz | BAT housekeeping file |
'' | sw00048753206bdqcb.hk.gz | BAT housekeeping file |
'' | sw00048753206ben.hk.gz | BAT housekeeping file |
'' | sw00048753206bevtlsp.hk.gz | BAT housekeeping file |
'' | sw00048753206bevtssp.hk.gz | BAT housekeeping file |
'' | sw00048753206bgocb.hk.gz | BAT housekeeping file |
'' | sw00048753206bhd.hk.gz | BAT housekeeping file |
00048753206/bat/masktag | sw00048753206bmt00010051.lc.gz | BAT mask tagged lightcurve |
'' | sw00048753206bmt00010051_rw.lc.gz | BAT raw mask tagged lightcurve |
'' | sw00048753206bmt00010067.lc.gz | BAT mask tagged lightcurve |
'' | sw00048753206bmt00010067_rw.lc.gz | BAT raw mask tagged lightcurve |
'' | sw00048753206bmt00010069.lc.gz | BAT mask tagged lightcurve |
'' | sw00048753206bmt00010069_rw.lc.gz | BAT raw mask tagged lightcurve |
00048753206/bat/rate | sw00048753206brt1s.lc.gz | BAT rate lightcurve |
'' | sw00048753206brtmc.lc.gz | BAT rate lightcurve |
'' | sw00048753206brtms.lc.gz | BAT rate lightcurve |
'' | sw00048753206brtqd.lc.gz | BAT rate lightcurve |
00048753206/bat/survey | sw00048753206bsvpbo2a19g08cf.dph.gz | BAT survey DPH |
So we're interested in just fetching the BAT event file. That file is called sw00048753206bevshpo_uf.evt.gz
in the listing above. To fetch this only, we could use the match
argument, and do the following:
g[0].download(bat=True,fetch=False,match='*bev*.evt.gz')
Path | Filename | Description |
---|---|---|
00048753206/bat/event | sw00048753206bevshpo_uf.evt.gz | BAT pointed unfiltered event event file |
Here we used standard unix/dos style wildcards to only select files that are BAT event files ('b' for BAT, 'ev' for event). However, we probably want those files in the auxil directory too, so let's make sure we get those also with our match, by adding a second match clause.
g[0].download(bat=True,fetch=False,match=['*bev*.evt.gz','*/auxil/*'])
Path | Filename | Description |
---|---|---|
00048753206/auxil | SWIFT_TLE_ARCHIVE.txt.21007.72373844.gz | Auxillary TLE file |
'' | sw00048753206pat.fits.gz | Auxillary attitude file |
'' | sw00048753206pjb.par.gz | Auxillary file |
'' | sw00048753206pob.cat.gz | Auxillary catalog |
'' | sw00048753206ppr.par.gz | Auxillary file |
'' | sw00048753206s.mkf.gz | Auxillary file |
'' | sw00048753206sao.fits.gz | Auxillary file |
'' | sw00048753206sat.fits.gz | Auxillary attitude file |
'' | sw00048753206sen.hk.gz | Auxillary housekeeping |
'' | sw00048753206sti.fits.gz | Auxillary file |
'' | sw00048753206x.mkf.gz | Auxillary file |
00048753206/bat/event | sw00048753206bevshpo_uf.evt.gz | BAT pointed unfiltered event event file |
That's pretty much all there is to it! Enjoy your data.